package com.yyw.util;

public class ResultFactory {

    private static Result result = new Result();

    public static Result result(Integer code, String msg, Object data) {
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

    public static Result result(Integer code, String msg) {
        result.setCode(code);
        result.setMsg(msg);
        result.setData(null);
        return result;
    }

    public static Result success(String msg, Object data) {
        result.setCode(200);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

    public static Result success(Object data) {
        result.setCode(200);
        result.setMsg("成功");
        result.setData(data);
        return result;
    }

    public static Result success(String msg) {
        result.setCode(200);
        result.setMsg(msg);
        result.setData(null);
        return result;
    }

    public static Result notice(String msg) {
        result.setCode(400);
        result.setMsg(msg);
        result.setData(null);
        return result;
    }

    public static Result failure(String msg, Object data) {
        result.setCode(500);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

    public static Result failure(String msg) {
        result.setCode(500);
        result.setMsg(msg);
        result.setData(null);
        return result;
    }

}
